Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add rustfmt.toml file to prevent flags.rs fmt on save #427

Merged
merged 3 commits into from
Sep 27, 2023
Merged

Conversation

PThorpe92
Copy link
Member

This prevents most LSP's/Editors that will auto run rustfmt on save. Most do not respect the .nix file, so this will keep flags.rs from getting formatted each time someone contributes.

@PThorpe92 PThorpe92 requested a review from cafkafk as a code owner September 26, 2023 17:05
@CobaltCause
Copy link

Might be easier to just stick #![rustfmt::skip] at the top of the file in question (and then remove the nix-specific exclusion)?

@ariasuni
Copy link
Contributor

Not sure why all the parameters, where do these come from?

@PThorpe92
Copy link
Member Author

PThorpe92 commented Sep 26, 2023

generated from rustfmt --print-config default rustfmt.toml

EDIT: Yeah after looking at the options, probably not worth just changing a couple of them. I just ran the command because I thought there was a reason we weren't using the #[rustfmt::skip] ? @gierens

I thought we had a rustfmt.toml file before anyway? Idk, could be useful at some point. but definitely got rid of all the options.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
@cafkafk
Copy link
Member

cafkafk commented Sep 27, 2023

Might be easier to just stick #![rustfmt::skip] at the top of the file in question (and then remove the nix-specific exclusion)?

Seems like clippy doesn't like it. I'll see if I can find an alternative


Run cargo clippy -- -D warnings
   Compiling eza v0.13.1 (/home/runner/work/eza/eza)
error: custom inner attributes are unstable
 --> src/options/flags.rs:1:4
  |
1 | #![rustfmt::skip]
  |    ^^^^^^^^^^^^^
  |
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #64266 </~https://github.com/rust-lang/rust/issues/64266>
  = note: `#[deny(soft_unstable)]` on by default

error: could not compile `eza` (lib) due to previous error
Error: Process completed with exit code 101.

See: rust-lang/rust#64266

@CobaltCause
Copy link

Huh, that's surprising. In that case I'd probably go for a rustfmt.toml with the one setting in it and get rid of the Nix-specific one so that things aren't at risk of going out of sync.

See: rust-lang/rust#64266
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
@cafkafk
Copy link
Member

cafkafk commented Sep 27, 2023

Huh, that's surprising. In that case I'd probably go for a rustfmt.toml with the one setting in it and get rid of the Nix-specific one so that things aren't at risk of going out of sync.

Yea, seems Nix respect the rustfmt one, so that seems like the correct way to handle this.

@cafkafk cafkafk merged commit 7cdc743 into main Sep 27, 2023
@cafkafk cafkafk deleted the p-rustfmt branch September 27, 2023 01:24
@CobaltCause
Copy link

Was removing this was forgotten? Seems like it should be redundant with this change, no?

formatter.rustfmt.excludes = ["src/options/flags.rs"];

@cafkafk
Copy link
Member

cafkafk commented Sep 27, 2023

Was removing this was forgotten? Seems like it should be redundant with this change, no?

Yeop 🤦‍♀️

@cafkafk
Copy link
Member

cafkafk commented Sep 27, 2023

Turns out, it doesn't read the rustfmt.toml. What I thought was it reading it was actually it reading it through taplo...

Welp, guess we'll need to do it two places for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants